package com.jerry.base.io.write;

import org.junit.Test;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
 * Created with IntelliJ IDEA
 * User: Jerry
 * Date: 2024/1/28
 * Time: 10:39
 * Description:
 */
public class PrintWriterUsage {

    @Test
    public void print() throws IOException {
        String filePath = "src/main/resources/io/printWriter.txt";
        try(PrintWriter printWriter = new PrintWriter(
                new FileWriter(filePath, StandardCharsets.UTF_8))) {
            printWriter.print("你好大宝宝");
        }
    }
}
